(function($){

	var MPG = this.MPG = (this.MPG || {});

	window.addEvent('domready', function(){

		var controller = new MPG.GalleryController($('gallery'), {
			current: 0,
			imageClass: 'page',
			onChangeEnd: function(index, element){
				$('current').set('html', index + 1);
			}
		});

		$('prev').addEvent('click', function(){
			controller.prev();
		});
		
		$('next').addEvent('click', function(){
			controller.next();
		});

		$('first').addEvent('click', function(){
			controller.first();
		});
		
		$('last').addEvent('click', function(){
			controller.last();
		});
	});

}(document.id));
